<li>
  <p>
    {% set format_search_base_url = (
       h.url_for(controller="organization", action="read", id=change.org_id)
       if change.org_id else
       h.url_for(controller="dataset", action="search")) %}

    {% if change.method == "add" %}

      {{ _('Set format of resource {resource_link} to {format_link} in
          {pkg_link}').format(
            pkg_link = '<a href="{pkg_url}">{pkg_name}</a>'.format(
              pkg_url = h.url_for(controller='dataset',
                                  action='read', id=change.pkg_id),
              pkg_name = change.title
            )|safe,
            resource_link = '<a href="{resource_url}">{resource_name}</a>'.format(
              resource_url = h.url_for(qualified=True, controller='resource',
                                        action='read', id=change.pkg_id,
                                        resource_id = change.resource_id),
              resource_name = change.resource_name
            )|safe,
            format_link = '<a href={format_url}>{format}</a>'.format(
              format_url = format_search_base_url + "?res_format=" + change.format,
              format = change.format
            )|safe
        ) }}

    {% elif change.method == "change" %}

      {{ _('Set format of resource {resource_link} to {new_format_link}
        (previously {old_format_link}) in {pkg_link}').format(
          pkg_link = '<a href="{pkg_url}">{pkg_name}</a>'.format(
            pkg_url = h.url_for(controller='dataset',
                                action='read', id=change.pkg_id),
            pkg_name = change.title
          )|safe,
          resource_link = '<a href="{resource_url}">{resource_name}</a>'.format(
            resource_url = h.url_for(qualified=True, controller='resource',
                                      action='read', id=change.pkg_id,
                                      resource_id = change.resource_id),
            resource_name = change.resource_name
          )|safe,
          old_format_link = '<a href={format_url}>{format}</a>'.format(
            format_url = format_search_base_url + "?res_format=" + change.old_format,
            format = change.old_format
          )|safe,
          new_format_link = '<a href={format_url}>{format}</a>'.format(
            format_url = format_search_base_url + "?res_format=" + change.new_format,
            format = change.new_format
          )|safe
        ) }}

    {% else %}

      {{ _('No fields were updated. See the metadata diff for more details.') }}

    {% endif %}
  </p>
</li>
